home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Table / Sources / TblCmds.cpp < prev    next >
Encoding:
Text File  |  1995-11-08  |  21.0 KB  |  678 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                TblCmds.cpp
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Author:                Mary Boetcher
  7. //
  8. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef TBLCMDS_H
  13. #include "TblCmds.h"
  14. #endif
  15.  
  16. #ifndef TBLFRAME_H
  17. #include "TblFrame.h"
  18. #endif
  19.  
  20. #ifndef TBLPART_H
  21. #include "TblPart.h"
  22. #endif
  23.  
  24. #ifndef TBLSEL_H
  25. #include "TblSel.h"
  26. #endif
  27.  
  28. #ifndef TBLPROXY_H
  29. #include "TblProxy.h"
  30. #endif
  31.  
  32. #ifndef TBLLINK_H
  33. #include "TblLink.h"
  34. #endif
  35.  
  36. // ----- Framework Includes -----
  37.  
  38. #ifndef FWPART_H
  39. #include "FWPart.h"
  40. #endif
  41.  
  42. #ifndef FWFRAME_H
  43. #include "FWFrame.h"
  44. #endif
  45.  
  46. #ifndef FWSELECT_H
  47. #include "FWSelect.h"
  48. #endif
  49.  
  50. #ifndef FWBARRAY_H
  51. #include "FWBArray.h"
  52. #endif
  53.  
  54. #ifndef FWFRMING_H
  55. #include "FWFrming.h"
  56. #endif
  57.  
  58. #ifndef FWLNKMGR_H
  59. #include "FWLnkMgr.h"
  60. #endif
  61.  
  62. // ----- OpenDoc Includes -----
  63.  
  64. #ifndef SOM_Module_OpenDoc_Commands_defined
  65. #include <CmdDefs.xh>
  66. #endif
  67.  
  68. #ifndef SOM_ODLinkSource_xh
  69. #include <LinkSrc.xh>
  70. #endif
  71.  
  72. #ifndef SOM_ODLinkSpec_xh
  73. #include <LinkSpec.xh>
  74. #endif
  75.  
  76. //========================================================================================
  77. //    Runtime Info
  78. //========================================================================================
  79.  
  80. #ifdef FW_BUILD_MAC
  81. #pragma segment odfTable
  82. #endif
  83.  
  84. //========================================================================================
  85. //    class CCellDragCommand
  86. //========================================================================================
  87.  
  88. //----------------------------------------------------------------------------------------
  89. //    CCellDragCommand constructor
  90. //----------------------------------------------------------------------------------------
  91.  
  92. CCellDragCommand::CCellDragCommand(    Environment* ev,
  93.                                     CTablePart* itsPart,
  94.                                     FW_CFrame* frame,
  95.                                     CTableSelection* selection) : 
  96.     FW_CDragCommand(ev, frame, FW_kCanUndo),
  97.     fTablePart(itsPart),
  98.     fTableSelection(selection),
  99.     fSavedProxy(NULL)
  100. {
  101.     fDragCell = selection->GetCell();
  102. }
  103.  
  104. //----------------------------------------------------------------------------------------
  105. //    CCellDragCommand destructor
  106. //----------------------------------------------------------------------------------------
  107.  
  108. CCellDragCommand::~CCellDragCommand()
  109. {
  110. }
  111.  
  112. //---------------------------------------------------------------------------------------
  113. //    CCellDragCommand::UndoIt
  114. //---------------------------------------------------------------------------------------
  115. void CCellDragCommand::UndoIt(Environment* ev)
  116. {
  117.     FW_ASSERT(fSavedProxy);
  118.  
  119.     // Restore saved proxy to the table
  120.     fSavedProxy->AttachEmbeddedFrames(ev);
  121.     fTablePart->AddProxy(fSavedProxy);
  122.     fTableSelection->SelectProxy(ev, fSavedProxy);
  123. }
  124.  
  125. //---------------------------------------------------------------------------------------
  126. //    CCellDragCommand::RedoIt
  127. //---------------------------------------------------------------------------------------
  128. void CCellDragCommand::RedoIt(Environment* ev)
  129. {
  130.     // Remove saved proxy, again
  131.     fTableSelection->SelectProxy(ev, fSavedProxy);
  132.     fTableSelection->ClearSelection(ev);
  133. }
  134.  
  135. //---------------------------------------------------------------------------------------
  136. //    CCellDragCommand::SaveUndoState
  137. //---------------------------------------------------------------------------------------
  138. void CCellDragCommand::SaveUndoState(Environment *ev)
  139. {
  140.     // Save the proxy for the part that was dragged
  141.     fSavedProxy = fTablePart->CellToProxy(ev, fDragCell);
  142. }
  143.  
  144. //---------------------------------------------------------------------------------------
  145. //    CCellDragCommand::FreeUndoState
  146. //---------------------------------------------------------------------------------------
  147. void CCellDragCommand::FreeUndoState(Environment *ev)
  148. {
  149.     fSavedProxy = NULL;
  150. }
  151.  
  152. //========================================================================================
  153. //    class CCellDropCommand
  154. //========================================================================================
  155.  
  156. //----------------------------------------------------------------------------------------
  157. //    CCellDropCommand constructor
  158. //----------------------------------------------------------------------------------------
  159.  
  160. CCellDropCommand::CCellDropCommand(    Environment* ev,
  161.                                     CTablePart* itsPart,
  162.                                     CTableFrame* frame,
  163.                                     ODDragItemIterator* dropInfo, 
  164.                                     ODFacet* odFacet,
  165.                                     const FW_CPoint& dropPoint,
  166.                                     const CCell& dropCell,
  167.                                     const CCell& draggedCell) : 
  168.     FW_CDropCommand(ev, (FW_CPart*)itsPart, frame, dropInfo, odFacet, dropPoint, FW_kCanUndo),
  169.     fTablePart(itsPart),
  170.     fTableFrame(frame),
  171.     fDropCell(dropCell),
  172.     fDraggedCell(draggedCell),
  173.     fSavedProxy(NULL)
  174. {
  175.     this->SetMenuStrings(ev, "Undo Drop", "Redo Drop");
  176.  
  177.     FW_END_CONSTRUCTOR
  178. }
  179.  
  180. //----------------------------------------------------------------------------------------
  181. //    CCellDropCommand destructor
  182. //----------------------------------------------------------------------------------------
  183.  
  184. CCellDropCommand::~CCellDropCommand()
  185. {
  186. }
  187.  
  188. //----------------------------------------------------------------------------------------
  189. // CCellDropCommand::DoDrop
  190. //----------------------------------------------------------------------------------------
  191.  
  192. FW_Boolean CCellDropCommand::DoDrop(Environment* ev, 
  193.                                     ODStorageUnit* dropSU, 
  194.                                     const FW_CPoint& mouseOffset,
  195.                                     const FW_CPoint& dropPoint,
  196.                                     FW_Boolean isDropMove)
  197. {
  198.     fTableFrame->SelectCell(ev, fDropCell, FALSE);
  199.     
  200.     return FW_CDropCommand::DoDrop(ev, dropSU, mouseOffset, dropPoint, isDropMove);
  201. }
  202.  
  203. //----------------------------------------------------------------------------------------
  204. // CCellDropCommand::DoDroppedInSameFrame
  205. //----------------------------------------------------------------------------------------
  206.  
  207. FW_Boolean CCellDropCommand::DoDroppedInSameFrame(Environment* ev, 
  208.                                                   ODStorageUnit* dropSU, 
  209.                                                   const FW_CPoint& originPoint, 
  210.                                                   const FW_CPoint& dropPoint)
  211. {
  212.     FW_UNUSED(dropSU);
  213.     
  214.     FW_ASSERT(fDropCell != fDraggedCell);
  215.         
  216.     // Move the frame's cell
  217.     
  218.     CTableProxy* proxy = fTablePart->CellToProxy(ev, fDraggedCell);
  219.     FW_ASSERT(proxy);
  220.  
  221.     fTableFrame->MoveProxy(ev, proxy, fDropCell);
  222.     fTablePart->ProxyMoved(ev, fDraggedCell, fDropCell);
  223.  
  224.     return TRUE;
  225. }
  226.  
  227. //---------------------------------------------------------------------------------------
  228. //    CCellDropCommand::UndoIt
  229. //---------------------------------------------------------------------------------------
  230. void CCellDropCommand::UndoIt(Environment* ev)
  231. {
  232.     FW_ASSERT(fSavedProxy);
  233.  
  234.     if (this->IsDragMoveInSameFrame(ev))    // simple move from one cell to another
  235.     {
  236.         // move the dropped part back to the cell it came from
  237.         fTableFrame->MoveProxy(ev, fSavedProxy, fDraggedCell);
  238.     }
  239.     else    // part was dropped here from outside
  240.     {
  241.         // remove the dropped cell from the table
  242.         CTableSelection* selection = fTableFrame->GetSelection(ev);
  243.         selection->SelectProxy(ev, fSavedProxy);
  244.         selection->ClearSelection(ev);
  245.     }
  246. }
  247.  
  248. //---------------------------------------------------------------------------------------
  249. //    CCellDropCommand::RedoIt
  250. //---------------------------------------------------------------------------------------
  251. void CCellDropCommand::RedoIt(Environment* ev)
  252. {
  253.     if (this->IsDragMoveInSameFrame(ev))    // simple move from one cell to another
  254.     {
  255.         // move the dropped part to the cell it was dropped in
  256.         fTableFrame->MoveProxy(ev, fSavedProxy, fDropCell);
  257.     }
  258.     else    // part was dropped here from outside
  259.     {
  260.         // re-drop the cell
  261.         fSavedProxy->AttachEmbeddedFrames(ev);
  262.         fTablePart->AddProxy(fSavedProxy);
  263.         fTableFrame->SelectCell(ev, fDropCell, TRUE);
  264.     }
  265. }
  266.  
  267. //---------------------------------------------------------------------------------------
  268. //    CCellDropCommand::SaveRedoState
  269. //---------------------------------------------------------------------------------------
  270. void CCellDropCommand::SaveRedoState(Environment *ev)
  271. {
  272.     // Save the proxy for the part that was just dropped
  273.     fSavedProxy = fTablePart->CellToProxy(ev, fDropCell);
  274. }
  275.  
  276. //---------------------------------------------------------------------------------------
  277. //    CCellDropCommand::FreeRedoState
  278. //---------------------------------------------------------------------------------------
  279. void CCellDropCommand::FreeRedoState(Environment *ev)
  280. {
  281.     // Delete the saved proxy
  282.     delete fSavedProxy;
  283. }
  284.  
  285. //====================================================================
  286. // CTableEditCommand class
  287. //====================================================================
  288.  
  289. FW_DEFINE_CLASS_M1(CTableEditCommand, FW_CEditCommand)
  290.  
  291. //--------------------------------------------------------------------
  292. // CTableEditCommand constructor
  293. //--------------------------------------------------------------------
  294. CTableEditCommand::CTableEditCommand(Environment* ev,
  295.                                      ODCommandID id,
  296.                                      CTablePart* itsPart, 
  297.                                      FW_CFrame* frame, 
  298.                                      CTableSelection* selection) :
  299.     FW_CEditCommand(ev, id, frame, FW_kCanUndo),
  300.     fTablePart(itsPart),
  301.     fTableSelection(selection),
  302.     fSavedProxy(NULL),
  303.     fSavedLink(NULL)
  304. {
  305. }
  306.  
  307. //--------------------------------------------------------------------
  308. // CTableEditCommand destructor
  309. //--------------------------------------------------------------------
  310. CTableEditCommand::~CTableEditCommand()
  311. {
  312. }
  313.  
  314. //--------------------------------------------------------------------
  315. // CTableEditCommand::DoClear, DoCut, DoPaste
  316. //    --- Override to call ContentUpdated
  317. //--------------------------------------------------------------------
  318. void CTableEditCommand::DoClear(Environment* ev)
  319. {
  320.     fTablePart->ContentUpdated(ev, fFrame, kODUnknownUpdate);
  321. }
  322.  
  323. //--------------------------------------------------------------------
  324. void CTableEditCommand::DoCut(Environment* ev)
  325. {
  326.     fTablePart->ContentUpdated(ev, fFrame, kODUnknownUpdate);
  327. }
  328.  
  329. //--------------------------------------------------------------------
  330. void CTableEditCommand::DoPaste(Environment* ev)
  331. {
  332.     if (fCommandID == kODCommandPasteAs)    // called from DoPasteAs
  333.         fCommandID = kODCommandPaste;        // for Undo
  334.     fTablePart->ContentUpdated(ev, fFrame, kODUnknownUpdate);
  335. }
  336.  
  337. //---------------------------------------------------------------------------------------
  338. //    CTableEditCommand::UndoIt
  339. //---------------------------------------------------------------------------------------
  340. void CTableEditCommand::UndoIt(Environment* ev)
  341. {
  342.     FW_CEditCommand::UndoIt(ev);    // call inherited
  343.  
  344.     switch (fCommandID)
  345.     {
  346.         case kODCommandCut:
  347.         case kODCommandClear:
  348.             this->RestoreSelection(ev);
  349.             break;
  350.  
  351.         case kODCommandPaste:
  352.             this->RemoveSelection(ev);
  353.             break;
  354.  
  355.         case kODCommandPasteAs:
  356.             this->UndoPasteAs(ev);
  357.     }    
  358. }
  359.  
  360. //---------------------------------------------------------------------------------------
  361. //    CTableEditCommand::RedoIt
  362. //---------------------------------------------------------------------------------------
  363. void CTableEditCommand::RedoIt(Environment *ev)    // Override
  364. {
  365.     FW_CEditCommand::RedoIt(ev);    // call inherited
  366.  
  367.     switch (fCommandID)
  368.     {
  369.         case kODCommandCut:
  370.         case kODCommandClear:
  371.             this->RemoveSelection(ev);
  372.             break;
  373.  
  374.         case kODCommandPaste:
  375.             this->RestoreSelection(ev);
  376.             break;
  377.  
  378.         case kODCommandPasteAs:
  379.             this->RedoPasteAs(ev);
  380.     }    
  381. }
  382.  
  383. /*----------------------------------------------------------------------------------------
  384. //    CTableEditCommand::Commit
  385. //----------------------------------------------------------------------------------------
  386. void CTableEditCommand::Commit(Environment *ev, ODDoneState doneState)    // Override
  387. {
  388.     // Called by FW_CPart::DisposeActionState before deleting the command
  389.     switch (fCommandID)
  390.     {
  391.         case kODCommandCut:
  392.         case kODCommandClear:
  393.             if (doneState == kODDone)
  394.                 this->DeleteSavedProxy(ev);
  395.             break;
  396.  
  397.         case kODCommandPaste:
  398.             if (doneState == kODUndone)
  399.                 this->DeleteSavedProxy(ev);
  400.             break;
  401.  
  402.         case kODCommandPasteAs:
  403.             this->CommitPasteAs(ev, doneState);
  404.     }
  405. }
  406. */
  407. //----------------------------------------------------------------------------------------
  408. //    CTableEditCommand::SaveUndoState
  409. //----------------------------------------------------------------------------------------
  410. void CTableEditCommand::SaveUndoState(Environment *ev)    // Override
  411. {
  412.     if ((fCommandID == kODCommandCut) || (fCommandID == kODCommandClear))
  413.         this->SaveSelection(ev);
  414. }
  415.  
  416. //----------------------------------------------------------------------------------------
  417. //    CTableEditCommand::FreeUndoState (doneState == kODDone)
  418. //----------------------------------------------------------------------------------------
  419. void CTableEditCommand::FreeUndoState(Environment *ev)    // Override
  420. {
  421.     if ((fCommandID == kODCommandCut) || (fCommandID == kODCommandClear))
  422.         this->DeleteSavedProxy(ev);
  423. }
  424.  
  425. //----------------------------------------------------------------------------------------
  426. //    CTableEditCommand::SaveRedoState
  427. //----------------------------------------------------------------------------------------
  428. void CTableEditCommand::SaveRedoState(Environment *ev)    // Override
  429. {
  430.     if (fCommandID == kODCommandPaste)
  431.     {
  432.         this->SaveSelection(ev);
  433.     }
  434.     else if (fCommandID == kODCommandPasteAs)
  435.     {
  436.         fPasteAsCell = fTableSelection->GetCell();
  437.     }
  438. }
  439.  
  440. //----------------------------------------------------------------------------------------
  441. //    CTableEditCommand::FreeUndoState (doneState == kODUndone)
  442. //----------------------------------------------------------------------------------------
  443. void CTableEditCommand::FreeRedoState(Environment *ev)    // Override
  444. {
  445.     if (fCommandID == kODCommandPaste)
  446.     {
  447.         this->DeleteSavedProxy(ev);
  448.     }
  449.     else if (fCommandID == kODCommandPasteAs)
  450.     {
  451.         delete fSavedLink;
  452.     }
  453. }
  454.  
  455. //---------------------------------------------------------------------------------------
  456. //    CTableEditCommand::SaveSelection
  457. //---------------------------------------------------------------------------------------
  458. void CTableEditCommand::SaveSelection(Environment* ev)
  459. {
  460.     //--- The selection is a single embedded frame ---
  461.     CCell cell = fTableSelection->GetCell();            // selected cell
  462.     fSavedProxy = fTablePart->CellToProxy(ev, cell);
  463. }
  464.  
  465. //---------------------------------------------------------------------------------------
  466. //    CTableEditCommand::RestoreSelection
  467. //---------------------------------------------------------------------------------------
  468. void CTableEditCommand::RestoreSelection(Environment* ev)
  469. {
  470.     // Re-attach the proxy's frames
  471.     fSavedProxy->AttachEmbeddedFrames(ev);
  472.  
  473.     // Add the saved proxy back into the table part
  474.     fTablePart->AddProxy(fSavedProxy);
  475.  
  476.     // Select it
  477.     fTableSelection->CloseSelection(ev);
  478.     fTableSelection->SelectProxy(ev, fSavedProxy);
  479.     fTableSelection->InvalidateSelection(ev);
  480. }
  481.  
  482. //---------------------------------------------------------------------------------------
  483. //    CTableEditCommand::RemoveSelection
  484. //---------------------------------------------------------------------------------------
  485. void CTableEditCommand::RemoveSelection(Environment* ev)
  486. {
  487.     // Make sure the saved proxy is selected
  488.     fTableSelection->CloseSelection(ev);
  489.     fTableSelection->SelectProxy(ev, fSavedProxy);
  490.  
  491.     // Save the selected proxy
  492.     this->SaveSelection(ev);
  493.     
  494.     // Clear the selection, which includes detaching the proxy frames.
  495.     fTableSelection->ClearSelection(ev);
  496. }
  497.  
  498. //---------------------------------------------------------------------------------------
  499. //    CTableEditCommand::DeleteSavedProxy
  500. //---------------------------------------------------------------------------------------
  501. void CTableEditCommand::DeleteSavedProxy(Environment* ev)
  502. {
  503.     FW_ASSERT(fSavedProxy);
  504.  
  505.     delete fSavedProxy;
  506.     fSavedProxy = NULL;
  507. }
  508.  
  509. //--------------------------------------------------------------------
  510. // CTableEditCommand::UndoPasteAs
  511. //--------------------------------------------------------------------
  512. void CTableEditCommand::UndoPasteAs(Environment* ev)
  513. {
  514.     //--- Break the link ---
  515.     CTableLinkManager* linkMgr = (CTableLinkManager*)fPart->GetLinkManager(ev);
  516.     fSavedLink = linkMgr->CellToSubscribeLink(ev, fPasteAsCell);
  517.     linkMgr->BreakSubscribeLink(ev, fSavedLink);
  518.  
  519.     //--- Remove the proxy frame ---
  520.     CTableProxy* proxy = fTablePart->CellToProxy(ev, fPasteAsCell);
  521.     proxy->RemoveEmbeddedFrames(ev);
  522.     fTablePart->RemoveProxy(proxy);
  523.     delete proxy;
  524.  
  525.     //--- Force redraw ---
  526.     fFrame->GetPresentation(ev)->Invalidate(ev);
  527. }
  528.  
  529. //--------------------------------------------------------------------
  530. // CTableEditCommand::RedoPasteAs
  531. //--------------------------------------------------------------------
  532. void CTableEditCommand::RedoPasteAs(Environment *ev)
  533. {
  534.     //-- Restore the broken link --
  535.     fPart->GetLinkManager(ev)->RestoreSubscribeLink(ev, fSavedLink);
  536. }
  537.  
  538. //--------------------------------------------------------------------
  539. // CTableEditCommand::CommitPasteAs
  540. /*--------------------------------------------------------------------
  541. void CTableEditCommand::CommitPasteAs(Environment* ev, ODDoneState doneState)
  542. {
  543.     if (doneState == kODUndone)
  544.     {
  545.         delete fSavedLink;
  546.         fSavedLink = NULL;
  547.     }
  548. }
  549. */
  550. //====================================================================
  551. // Constants for CBreakLinkSourceCommand and CBreakLinkCommand
  552. //====================================================================
  553.  
  554. const ODCommandID kBreakLinkSourceID = 12345;
  555. const ODCommandID kBreakLinkID = 56789;
  556.  
  557. //====================================================================
  558. // CBreakLinkSourceCommand class
  559. //====================================================================
  560.  
  561. FW_DEFINE_CLASS_M1(CBreakLinkSourceCommand, FW_CCommand)
  562.  
  563. //--------------------------------------------------------------------
  564. // CBreakLinkSourceCommand constructor
  565. //--------------------------------------------------------------------
  566. CBreakLinkSourceCommand::CBreakLinkSourceCommand(Environment* ev,
  567.                                                  FW_CFrame* frame, 
  568.                                                  CTablePublishLink* linkSource) :
  569.     FW_CCommand(ev, kBreakLinkSourceID, frame, FW_kCanUndo),
  570.     fLinkSource(linkSource)
  571. {
  572.     this->SetMenuStrings(ev, "Restore Link", "Break Link");
  573. }
  574.  
  575. //--------------------------------------------------------------------
  576. // CBreakLinkSourceCommand destructor
  577. //--------------------------------------------------------------------
  578. CBreakLinkSourceCommand::~CBreakLinkSourceCommand()
  579. {
  580. }
  581.  
  582. //--------------------------------------------------------------------
  583. // CBreakLinkSourceCommand::DoIt
  584. //--------------------------------------------------------------------
  585. void CBreakLinkSourceCommand::DoIt(Environment* ev)
  586. {
  587.     //-- Break the link --
  588.     fPart->GetLinkManager(ev)->BreakPublishLink(ev, fLinkSource);
  589.     fPart->Changed(ev);
  590. }
  591.  
  592. //--------------------------------------------------------------------
  593. void CBreakLinkSourceCommand::UndoIt(Environment* ev)
  594. {
  595.     //-- Restore the broken link --
  596.     fPart->GetLinkManager(ev)->RestorePublishLink(ev, fLinkSource);
  597.     fPart->Changed(ev);
  598. }
  599.  
  600. //--------------------------------------------------------------------
  601. void CBreakLinkSourceCommand::RedoIt(Environment* ev)
  602. {
  603.     this->DoIt(ev);    // just DoIt
  604. }
  605.  
  606. //--------------------------------------------------------------------
  607. void CBreakLinkSourceCommand::CommitDone(Environment* ev)
  608. {
  609.     // Delete the saved link source only if the command was not undone
  610.     fLinkSource->GetODLinkSource(ev)->Release(ev);
  611.     fLinkSource->SetODLinkSource(ev, NULL);
  612.     delete fLinkSource;
  613. }
  614.  
  615. //====================================================================
  616. // CBreakLinkCommand class
  617. //====================================================================
  618.  
  619. FW_DEFINE_CLASS_M1(CBreakLinkCommand, FW_CCommand)
  620.  
  621. //--------------------------------------------------------------------
  622. // CBreakLinkCommand constructor
  623. //--------------------------------------------------------------------
  624. CBreakLinkCommand::CBreakLinkCommand(Environment* ev,
  625.                                      FW_CFrame* frame, 
  626.                                      CTableSubscribeLink* linkDestination) :
  627.     FW_CCommand(ev, kBreakLinkID, frame, FW_kCanUndo),
  628.     fLink(linkDestination)
  629. {
  630.     this->SetMenuStrings(ev, "Restore Link", "Break Link");
  631. }
  632.  
  633. //--------------------------------------------------------------------
  634. // CBreakLinkCommand destructor
  635. //--------------------------------------------------------------------
  636. CBreakLinkCommand::~CBreakLinkCommand()
  637. {
  638. }
  639.  
  640. //--------------------------------------------------------------------
  641. // CBreakLinkCommand::DoIt
  642. //--------------------------------------------------------------------
  643. void CBreakLinkCommand::DoIt(Environment* ev)
  644. {
  645.     //-- Break the link --
  646.     fPart->GetLinkManager(ev)->BreakSubscribeLink(ev, fLink);
  647.     fPart->Changed(ev);
  648. }
  649.  
  650. //--------------------------------------------------------------------
  651. // CBreakLinkCommand::UndoIt
  652. //--------------------------------------------------------------------
  653. void CBreakLinkCommand::UndoIt(Environment* ev)
  654. {
  655.     //-- Restore the broken link --
  656.     fPart->GetLinkManager(ev)->RestoreSubscribeLink(ev, fLink);
  657.     fPart->Changed(ev);
  658. }
  659.  
  660. //--------------------------------------------------------------------
  661. // CBreakLinkCommand::RedoIt
  662. //--------------------------------------------------------------------
  663. void CBreakLinkCommand::RedoIt(Environment* ev)
  664. {
  665.     this->DoIt(ev);    // just DoIt
  666. }
  667.  
  668. //--------------------------------------------------------------------
  669. // CBreakLinkCommand::CommitDone
  670. //--------------------------------------------------------------------
  671. void CBreakLinkCommand::CommitDone(Environment* ev)
  672. {
  673.     // Delete the saved link destination only if the command was not undone
  674.     delete fLink;
  675. }
  676.  
  677.  
  678.